# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2025/3/1
desc: 
sample: 
"""
# def dosomething(a):
#     print(f'do something{type(a)}')
#
# data4 = {
#     'name': '张三',
#     'age': 18,
#     'sex': '男'
# }
#
# dosomething(data4)
# dosomething('hello world')
# a=dosomething('hello')
# print(a)
#
# #关键词参数
# def do_something1(a1,a2):
#    print(f"type_a {type(a1)}, type_a2 {type(a2)} a1={a1}, a2={a2}")
#
# do_something1(1,2)
# do_something1(a2=1,a1=2)
#
# #默认参数
# def do_something2(a1,a2=10):
#    print(f"type_a {type(a1)}, type_a2 {type(a2)} a1={a1}, a2={a2}");
#
# do_something2(1)
# do_something2(1,{'a':10})


def do_something3(a1,*args):
    print(f"type_a {type(a1)}, type_args {type(args)} a1={a1}, a2={args}")

do_something3(1)
do_something3(1,11)
do_something3(9,11,123123)
do_something3(9,["abc","abc"])
do_something3(9,{"abc","abc"})

def do_something4(a1,**kwargs):
  print(f"type_a {type(a1)}, kwargs {type(kwargs)} a1={a1}, kwargs={kwargs}")

do_something4(2,x=2) #正确
do_something4(1,v1=1,x=11)
do_something4(a1=2,x=2)
do_something4(a1=2,a2=3,x=2)


def do_something5(*args,**kwargs):
    print(f"type_args {type(args)}, kwargs {type(kwargs)} args={args}, kwargs={kwargs}")

do_something5()
do_something5(11,22)
do_something5(k1=11,k2=22)
do_something5(11,22,k1=11)
do_something5((11,22),k1=11,k2=22)
do_something5((11,22),[1,2],k1=11,k2=22)

data4 = {
    'name': '张三',
    'age': 18,
    'sex': '男'
}
do_something5(data4)
do_something5(**data4)




def func(a1,a2):
   return a1 + a2

fun3 = lambda a1,a2: a1 + a2


def demo(name: str, age: int) -> str:
    if isinstance(age, int):
        age = age + 1
    print(f"name {name},age {age}")
    return "demo"

print(demo(1, 2))